<!--商品详情-->
<template>
	<div class="w store-content">
<!--		<div class="search-box">
			<search class="search-dom"></search>
		</div>-->
	    <div class="nav-subs">
	      <div class="nav-sub-bgs"></div>
	      <div class="nav-sub-wrappers">
	        <div class="w">
	          <ul class="nav-lists">
	            <li>
	              <router-link to="/">
	                <a>首页</a>
	              </router-link>
	            </li>
	            <li>
            		<router-link to="/leveling">
	               		<a>游戏代练</a>
              		</router-link>
	            </li>
 			  	     <li>
 			  	     	<router-link to="/levelingDetails">
	               		<a class="active">账号图文详情</a>
              		</router-link>
	            </li>
	          </ul>
	        </div>
	      </div>
	    </div>

		<div class="gray-box">
			<div class="gallery-wrapper">
				<div class="gallery">
					<div class="thumbnail">
						<ul>
							<li v-for="(item,i) in small" :key="i" :class="{on:big===item}" @click="big=item">
								<img v-lazy="item" :alt="product.name">
							</li>
						</ul>
					</div>
					<div class="thumb">
						<div class="big">
							<img :src="big" :alt="product.name">
						</div>
					</div>
				</div>
			</div>
			<!--右边-->
			<div class="banner">
				<div class="sku-custom-title">
					<h4>{{product.name}}</h4>
					<h6>
            <span class="price">
              <em>¥</em><i>{{Number(product.price).toFixed(2)}}</i></span>
          </h6>
				</div>
				<!-- 选择规格 -->
				<div class="item-select">
					<div class="item-select-title">
						<p class="i-title">商品编号：</p>
						<p class="i-value">{{product.id}}</p>
					</div>
					<div class="item-select-title">
						<p class="i-title">游戏分类：</p>
						<p class="i-value">{{product.productCategoryName}}</p>
					</div>
					<div class="item-select-title">
						<p class="i-title">游戏大区：</p>
						<p class="i-value">{{product.gameGroup}} - {{product.gameServer}}</p>
					</div>
					<div class="item-select-title">
						<p class="i-title">浏览次数：</p>
						<p class="i-value">{{product.hit}}</p>
					</div>
          <div class="item-select-title">
            <p class="i-title">商品状态：</p>
            <p class="i-value_status" v-for="status in goodStatus">{{status}}</p>
          </div>
				</div>
				<div class="item-btn-box">
					<button class="item-btn" @click="callQQService(qqCharNum)">联系QQ客服</button>
					<button class="item-btn" @click="callWecharService(WeCharNum)">联系微信客服</button>
					<input type="text" style="width: 0.5px;" id="wecharNum" v-model="WeCharNum"/>
				</div>
			</div>
		</div>
		<!--产品信息-->
		<div class="item-info">
			<y-shelf title="账号图文详情">
				<div slot="content">
					<div class="img-item" v-if="productMsg">
            <div v-html="productMsg" v-lazy-container="{ selector: 'img'}">{{ productMsg }}</div>
					</div>
					<div class="no-info" v-else>
						<img src="/static/images/no-data.png">
						<br> 该商品暂无内容数据
					</div>
				</div>
			</y-shelf>
		</div>
		<right-nav></right-nav>
	</div>
</template>
<script>
	import { levelingproductDet,getContactInfo } from '/api/goods'
//	import { currency } from '/api/utils'
	import { mapMutations, mapState } from 'vuex'
	import YShelf from '/components/shelf'
	import rightNav from '/components/rightNav'
	import search from '/components/searchBox'
	import { getStore } from '/utils/storage'
	export default {
    metaInfo: {
      title: '无忧账号游戏代练详情-账号交易首选无忧-账号找回永久包赔-所售账号不转手永久包赔', // set a title
      meta: [{                 // set meta
        name: 'keywords',
        content: '5u，5u账号，5u258，5u游戏，游戏账号交易，无忧账号，游戏帐号交易平台,5u258交易平台，5u258官网，王者荣耀，CF枪战之王，火影忍者，QQ飞车手游，和平精英，穿越火线，英雄联盟，逆战，霸气玩，租号玩，买卖账号'
      },{                 // set meta
        name: 'description',
        content: '无忧账号，是国内专业安全的游戏帐号交易平台，账号找回永久包赔，所售账号不转手永久包赔。玩家可以通过极其优惠的价格购买王者荣耀，CF枪战之王，火影忍者，QQ飞车手游，和平精英，穿越火线，英雄联盟，逆战等游戏的极品号。'
      }]
    },
		data() {
			return {
				productMsg: {},
				selectBoxIndex: 0,
				small: [],
				big: '',
				product: {
					salePrice: 0
				},
				userId: '',
				curLocation: '',
        goodStatus:[],//商品状态
        WeCharNum:'',
        qqCharNum:'',
			}
		},
		computed: {
			...mapState(['login', 'showMoveImg','navIndex'])
		},
		methods: {
			...mapMutations(['CHANGE_NAV']),
      levelingproductDet(id) {
        levelingproductDet({
					id: id
				}).then(res => {
					let result = res.data;
					this.product = result.goods.levelingGoods;
          let contentHTML = this.product.detailHtml.replace(/src/g,'data-src');
          this.productMsg = contentHTML || '';
					var subImages = this.product.albumPics;
					this.small = subImages.split(',');
					this.big = this.small[0];


          // 出售状态
          var verfiyStatus = this.product.verifyStatus;
          if (verfiyStatus=='0'){
            this.goodStatus.push('代练服务未审核 ');
          }else if ( verfiyStatus=='1'){
            this.goodStatus.push('官方已审核通过 ');
          }

          var pubStatus = this.product.publishStatus;
          if (pubStatus && pubStatus=='0'){
            this.goodStatus = [];
            this.goodStatus.push('代练服务已被官方下架');
          }else  if (pubStatus && pubStatus=='1'){
            this.goodStatus.push('代练服务出售中');
          }

          var delStatus = this.product.deleteStatus;
          if (delStatus=='0'){
            // this.goodStatus.push('未删除');
          }else if ( delStatus=='1'){
            this.goodStatus = [];
            this.goodStatus.push('代练服务已停止');
          }
				}).catch((e) => {
					console.log(e)
				});
			},
      callQQService(item) {
        var aa = document.createElement("a");
        aa.target="_blank";
        aa.href = "http://wpa.qq.com/msgrd?v=3&uin="+item+"&site=qq&menu=yes";
        aa.click();
      },
      callWecharService(item) {
        var mes = "已复制官方微信   "+item+ "  ,请在微信里面添加客服好友";
        var wecharNumDom = document.getElementById("wecharNum");
        wecharNumDom.select();
        document.execCommand("Copy");
        this.$alert(mes, '无忧账号-官方认证微信号', {
          confirmButtonText: '确定',
          callback: action => {
            this.$message({
              type: 'info',
              message: `action: ${ action }`
            });
          }
        });
      },
      // 获取联系方式
      getWxChatContactList() {
        getContactInfo({isMain:1,sellerOrBuyer:'buyer',type:'WECHAT'}).then(response => {
          this.WeCharNum = response.data.contact;
        });
      },
      getQqContactList() {
        getContactInfo({isMain: 1, sellerOrBuyer: 'buyer', type: 'QQ'}).then(response => {
          this.qqCharNum = response.data.contact;
        });
      }
		},
		created() {
      this.getWxChatContactList();
      this.getQqContactList();
			let id = this.$route.query.id
			this.levelingproductDet(id);
			this.userId = getStore('userId');
			this.CHANGE_NAV(3);
		},
		filters: {
//			currency: currency
		},
		components: {
			YShelf,
			search,
			rightNav
		}
	}
</script>
<style lang="scss" scoped>
	@import "../../assets/style/mixin";
  .nav-subs {
    position: relative;
    z-index: 20;
    height: 60px;
    background: #f7f7f7;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .04);
    .nav-sub-wrappers{
      padding: 20px 0;
      height: 50px;
      position: relative;
    }
    .w {
      display: flex;
      justify-content: space-between;
    }
    .nav-lists {
      height: 28px;
      line-height: 28px;
      display: flex;
      align-items: center;
      height: 100%;
      li:first-child {
        padding-left: 0;
        a {
          padding-left: 10px;
        }
      }
      li {
        position: relative;
        float: left;
        padding-left: 2px;
        a {
          display: block;
          // cursor: default;
          padding: 0 10px;
          color: #666;
          &.active {
            font-weight: bold;
          	color: #FF8700;
          }
        }
        a:hover {
          color: #FF8700;
        }
      }
      li:before {
        content: ' ';
        position: absolute;
        left: 0;
        top: 13px;
        width: 2px;
        height: 2px;
        background: #bdbdbd;
      }
    }
  }

	.store-content {
		clear: both;
		width: 1100px;
		min-height: 600px;
		padding: 0 0 25px;
		margin: 20px auto;
	}

	.search-box {
		width: 100%;
		height: 90px;
		position: relative;
		margin-top: 30px;
	}
	.search-dom{
		position: relative;
		width: 80%;
		float: right;
		right: 0;

	}

	.gray-box {
		display: flex;
		padding: 60px;
		margin: 20px 0;
		.gallery-wrapper {
			.gallery {
				display: flex;
				width: 540px;
				.thumbnail {
					li:first-child {
						margin-top: 0px;
					}
					li {
						@include wh(80px);
						margin-top: 10px;
						padding: 12px;
						border: 1px solid #f0f0f0;
						border: 1px solid rgba(0, 0, 0, .06);
						border-radius: 5px;
						cursor: pointer;
						&.on {
							padding: 10px;
							border: 3px solid #ccc;
							border: 3px solid rgba(0, 0, 0, .2);
						}
						img {
							display: block;
							@include wh(100%);
						}
					}
				}
				.thumb {
					.big {
						margin-left: 20px;
					}
					img {
						display: block;
						@include wh(440px)
					}
				}
			}
		}
		// 右边
		.banner {
			width: 450px;
			margin-left: 10px;
			h4 {
				font-size: 18px;
				line-height: 1.25;
				color: #000;
				margin-bottom: 13px;
			}
			h6 {
				font-size: 14px;
				line-height: 1.5;
				color: #bdbdbd;
				display: flex;
				align-items: center;
				justify-content: space-between;
			}
			.sku-custom-title {
				overflow: hidden;
				padding: 8px 8px 18px 10px;
				position: relative;
			}
			.params-name {
				padding-right: 20px;
				font-size: 14px;
				color: #8d8d8d;
				line-height: 36px;
			}
		}
	}
  .i-value_status {
    width: 27%;
    height: 100%;
    color: black;
  }
	.item-info {
		.gray-box{
			padding: 0;
			display: block;
		}
		.img-item {
			width: 1220px;
			/*padding: 1vw;*/
			text-align: center;
			img {
				width: 100%;
				height: auto;
				display: block;
			}
		}
	}
	.img-item /deep/ p{
		width: 98%;
	}
	.img-item /deep/ /deep/ .wscnph{
		width: 99%;
	}
	.i-title {
		width: 20%;
		height: 100%;
	}

	.i-value {
		width: 50%;
		height: 100%;
		color: black;
	}

	.no-info {
		padding: 200px 0;
		text-align: center;
		font-size: 30px;
	}

	.price {
		display: block;
		color: #d44d44;
		font-weight: 700;
		font-size: 16px;
		line-height: 20px;
		text-align: right;
		margin-top: 20px;
		margin-left: 20px;
		i {
			padding-left: 2px;
			font-size: 24px;
		}
	}

	.item-select {
		border-bottom: 1px solid #E5E5E5;
		margin-left: 20px;
	}

	.item-select-title {
		height: 40px;
		display: flex;
		padding-left: 20px;
	}

	.item-btn-box {
		width: 100%;
		height: 50px;
		margin-top: 20px;
	}

	.item-btn {
		width: 120px;
		height: 80%;
		margin-left: 40px;
		border-radius: 5px;
		background-color: #FF8700;
		color: white;
		cursor: pointer;
	}
	@media (max-width: 1340px) {
		body {
			min-width: 1340px;
		}
		.store-content {
			width: 1000px;
		}
		.search-box {
			right: 0;
			width: 100%;
		}
	}

	@media (min-width: 1700px) {
		body {
			min-width: 1470px;
		}
		.store-content {
			width: 1200px;
		}
	}
</style>
